package com.jjb.www.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.hjq.shape.view.ShapeTextView;
import com.hjq.widget.layout.WrapRecyclerView;
import com.jjb.www.R;
import com.jjb.www.app.AppAdapter;
import com.jjb.www.http.api.GetStudentPlanDetailApi;

/**
 *    author : Android CRG
 *    github : https://github.com/getActivity/AndroidProject
 *    time   : 2018/11/05
 *    desc   : 可进行拷贝的副本
 */
public final class StudentPlan1Adapter extends AppAdapter<GetStudentPlanDetailApi.Bean.ListDTO> {

    public StudentPlan1Adapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<?>.ViewHolder {
        private ShapeTextView mTvTitle;
        private WrapRecyclerView mRvList;
        private StudentPlan2Adapter adapter;


        private ViewHolder() {
            super(R.layout.item_student_plan);
            mTvTitle = findViewById(R.id.tv_title);
            mRvList = findViewById(R.id.rv_list);
            mRvList.setLayoutManager(new LinearLayoutManager(getContext()));
            adapter = new StudentPlan2Adapter(getContext());
            mRvList.setAdapter(adapter);
        }

        @Override
        public void onBindView(int position) {
            mTvTitle.setText(getItem(position).getDay());
            adapter.setData(getItem(position).getList());
        }
    }
}